package com.huashizhaoxi.lionapp.dao;

import com.huashizhaoxi.lionapp.entity.Notice;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface NoticeMapper {
    @Select("select * from notice where type = #{type} order by posttime desc")
    List<Notice> getNoticeByType(int type);

    @Insert("insert into notice(title,publisher,link_url,posttime,type,deadline,label) values(#{title},#{publisher},#{link_url},#{posttime},#{type},#{deadline},#{label})")
    int addNotice(Notice notice);

    @Select("select * from notice where title like concat('%',#{keyword},'%') or publisher like concat('%',#{keyword},'%') order by posttime desc")
    List<Notice> searchNotice(String keyword);

    @Select("select * from notice order by posttime desc")
    List<Notice> getNewNotice();
}
